<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" import="pojo.*,service.*,dao.*"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
   function add(){
	    var num = document.getElementById("count").value;
	    document.getElementById("count").value=(parseInt(num)+1)+"";
	    return false;
   }
   function reduce(){
	    var num = document.getElementById("count").value;
	    document.getElementById("count").value=num-1;
	    return false;
  }
</script>
<style type="text/css">
.content{
width:500px;
margin:0 auto;
border:2px solid blue;
}
.top{
width:500px;
overflow:hidden;
}
.left{
width:200px;
margin-right:20px;
float:left
}
.right{
width:200px;
float:right;
}
.right .pname{
font-size:36px;
}
.right .pprice{
background-color:#ccc;
}
</style>
</head>
<body>
<h1>商品详情</h1>
<%
   Product p = (Product)request.getAttribute("p");
%>
<form action="CartServlet?method=add" method="post">
<div class="content">
<div class="top">
<div class="left"><img src="<%=p.getP_image() %>"/></div>
<div class="right">
    <div class="pname"><%=p.getP_name() %></div>
    <div class="pprice">价格 <%=p.getP_price() %></div>
    
     <div class="pcount">数量<button onclick="return reduce();">-</button><input type="text" id="count" value="1" name="count" size="5"/><button onclick="return add();">+</button></div>
   <input type="hidden" name="pid" value="<%=p.getP_id() %>"/>
 <button>加入购物车</button>   <button>立即购买</button>
</div>
</div>
<div class="bottom">
<div class="pdescription">
     商品详情<br/>
  <%=p.getP_description() %></div>
</div>
</div>
</form>
</body>
</html>